package com.ao.andou.common;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;

import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.util.Log;

public class DrawableHelper {

    public static Drawable getDrawableFromUrl(String url) {
        Drawable drawable = null;
        String decodeUri = Uri.decode(url);
        Log.d("getDrawableFromUrl", decodeUri);
        try {
            drawable = Drawable.createFromStream((InputStream) new URL(decodeUri).getContent(), "");
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return drawable;
    }
}
